package PRSystem_Service;

import java.util.ArrayList;
import java.util.Scanner;

import PRSystem_DAO.PRSystemPerformanceDAO;
import PRSystem_DAO.PRSystemPerformanceDAOImpl;
import PRSystem_VO.PRSystem_PerformanceVO;

public class PRSystemPerformanceServiceImpl implements
		PRSystemPerformanceService {

	private PRSystemPerformanceDAO prpdao;

	public PRSystemPerformanceServiceImpl() {
		prpdao = new PRSystemPerformanceDAOImpl();
	}

	@Override
	public void newPerformance() {
		PRSystem_PerformanceVO prpvo = new PRSystem_PerformanceVO();
		System.out.println(prpdao.insertPerformance(prpvo));
	}

	@Override
	public void readPerformance() {
		ArrayList<PRSystem_PerformanceVO> prpvos = new ArrayList<>();
		prpvos = prpdao.selectPerformance();
		for (PRSystem_PerformanceVO p : prpvos) {
			System.out.println(p);
		}
	}

	@Override
	public void readOnePerformance() {
		Scanner sc = new Scanner(System.in);
		System.out.println("공연정보는 공연번호, 공연제목, 공연날짜, 공연장이름으로 조회가 가능합니다.");
		int perNo = sc.nextInt();
		ArrayList<PRSystem_PerformanceVO> prpvos = new ArrayList<>();
		prpvos = prpdao.selectOnePerformance(perNo);
		for (PRSystem_PerformanceVO p : prpvos) {
			System.out.println(p);
		}
	}

	@Override
	public void modifyPerformance() {
		Scanner sc = new Scanner(System.in);
		System.out.println("수정할 공연의 공연번호를 입력하세요.");
		int perNo = sc.nextInt();
		PRSystem_PerformanceVO prpvo = new PRSystem_PerformanceVO();
		System.out.println(prpdao.updatePerformance(perNo));
	}

	@Override
	public void removePerformance() {
		Scanner sc = new Scanner(System.in);
		System.out.println("삭제할 공연번호를 입력하세요");
		int perNo = sc.nextInt();
		PRSystem_PerformanceVO prpvo = new PRSystem_PerformanceVO();
		System.out.println(prpdao.deletePerformance(perNo));
	}

}
